import { createStore } from 'vuex'
import {sessionStorage} from '../utils/storage'

export default createStore({
  state: {
    children:JSON.parse(sessionStorage.get('children'))||[]

  },
  getters: {
    getChild(state){
      return state.children
    }
  },
  mutations: {
    setState(state,child){
      state.children=child
      sessionStorage.set('children',JSON.stringify(child))
    }
  },
  actions: {
    setChild({commit},child){
      commit('setState',child)
    }
  },
  modules: {
  }
})
